package com.hgm.study.model

import com.squareup.moshi.Moshi
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
import retrofit2.Retrofit
import retrofit2.converter.moshi.MoshiConverterFactory


object Network {

      private const val baseUrl =
            "https://mock.apipost.cn/app/mock/project/ced69cf2-9206-4a42-895e-dd7442a888df/"


      private val retrofit = Retrofit.Builder()
            .baseUrl(baseUrl)
            .addConverterFactory(
                  MoshiConverterFactory.create(
                        Moshi.Builder()
                              .add(KotlinJsonAdapterFactory())
                              .build()
                  )
            )
            .build()


      fun <T> createService(clazz: Class<T>): T {
            return retrofit.create(clazz)
      }

}